
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html >
<html>
<head>
<title></title>
<!-- context path -->
<link rel="stylesheet" href="plug-in/graphreport/css/report.css" type="text/css"></link>
<link rel="stylesheet" href="plug-in/tools/css/common.css" type="text/css"></link>
<script type="text/javascript" src="plug-in/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="plug-in/tools/dataformat.js"></script>
<link id="easyuiTheme" rel="stylesheet" href="plug-in/easyui/themes/default/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="plug-in/easyui/themes/icon.css" type="text/css"></link>
<link rel="stylesheet" type="text/css" href="plug-in/accordion/css/accordion.css">
<link rel="stylesheet" type="text/css" href="plug-in/accordion/css/icons.css">
<script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
<script type="text/javascript" src="plug-in/easyui/locale/zh-cn.js"></script>
<script type="text/javascript" src="plug-in/tools/syUtil.js"></script>
<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
<script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
<script type="text/javascript" src="plug-in/tools/easyuiextend.js"></script>
<script type="text/javascript" src="plug-in/easyui/extends/datagrid-scrollview.js"></script>
<script type="text/javascript" src="plug-in/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="plug-in/graphreport/highcharts3.0.6.js"></script>
<script type="text/javascript" src="plug-in/graphreport/spin.min.js"></script>
<script type="text/javascript" src="plug-in/graphreport/report.js"></script>
</head>
<body>
<div class="operations" style="text-align: right;"> 
	<div class="bd3">
		<span style="display:-moz-inline-box;display:inline-block;">
			<c:if test="${show=='y' }">
			<span style="display:-moz-inline-box;display:inline-block;width: 100px;text-align:right;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; position: relative;top: 3px" >地市：</span>
			<select name="depart" WIDTH="100" style="width: 104px" class="easyui-combobox">
				<option value="0">请选择</option>
				<option value="A04A01">广州</option>
				<option value="A04A02">佛山</option>
			</select>
			</c:if>
			<c:if test="${show2=='y' }">
			<span style="display:-moz-inline-box;display:inline-block;width: 100px;text-align:right;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; position: relative;top: 3px" >区域：</span>
			<select name="area" WIDTH="100" style="width: 104px" class="easyui-combobox">
				<option value="0">请选择</option>
				<option value="1">城区</option>
				<option value="2">高速</option>
			</select>
			</c:if>
			
			<c:if test="${check=='y' }">
			<span style="display:-moz-inline-box;display:inline-block;width: 100px;text-align:right;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; position: relative;top: 3px" >抽查情况：</span>
			<select name="spotCheck" WIDTH="100" style="width: 104px" class="easyui-combobox">
				<option value="0">请选择</option>
				<option value="n">未抽查</option>
				<option value="p">合格</option>
				<option value="f">不合格</option>
			</select>
			</c:if>
			
			<c:if test="${sat=='y' }">
			<span style="display:-moz-inline-box;display:inline-block;width: 100px;text-align:right;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; position: relative;top: 3px" >满意度：</span>
			<select name="sat" WIDTH="100" style="width: 104px" class="easyui-combobox">
				<option value="">请选择</option>
				<option value="1">非常满意</option>
				<option value="2">满意</option>
				<option value="0">不满意</option>
				<option value="no">没反馈</option>
			</select>
			</c:if>
		<c:forEach var="query" items="${queryList }">
			
			<span style="display:-moz-inline-box;display:inline-block;width: 100px;text-align:right;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; position: relative;top: 3px" title="${query.field_txt }">${query.field_txt }：</span>
			
			<c:if test="${query.SEARCH_MODE=='group' }">
				<c:if test="${query.field_type=='Date' }">
				<input type="text" name="${query.field_name}_begin"  style="width: 94px"  class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" /></c:if>
				<span style="display:-moz-inline-box;display:inline-block;width: 8px;text-align:right;">~</span>
				<c:if test="${query.field_type=='Date' }">
				<input type="text" name="${query.field_name}_end"  style="width: 94px" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" /></c:if>
			</c:if>
	
			<c:if test="${query.SEARCH_MODE=='single' }">
		
				<c:if test="${fn:length(query.field_dictlist)>0 }">
					
					<c:if test="${query.field_type=='ComboGrid' }">
						<input type="text" name="${query.field_name}" id="${query.field_name}"  style="width: 100px"/>
					</c:if>
					<c:if test="${query.field_type!='ComboGrid' }">
						<select name = "${query.field_name}" WIDTH="100" style="width: 104px" class="easyui-combobox">
						<option value = "">---请选择---</option>
							<c:forEach var="xd" items="query.field_dictlist">
							<option value = "${xd.typecode}">${xd.typename}</option>
							</c:forEach>

						</select>
					</c:if>
			     </c:if>
	
				
				
				<c:if test="${fn:length(query.field_dictlist)<=0 }">
					
					<c:if test="${query.field_type=='Date' }">
					<input type="text" name="${query.field_name}_month"  style="width: 100px" class="Wdate" onclick="WdatePicker({dateFmt: 'yyyy-MM', isShowToday: false,maxDate:'%y-%M'});"  /> 
					</c:if>
					<c:if test="${query.field_type!='Date' }">
					<input type="text" name="${query.field_name}"  style="width: 100px"   /> 
					</c:if>
				</c:if>
			</c:if>
			</span>	
	</c:forEach> 
	
			<span style="display:-moz-inline-box;display:inline-block;margin-top: 5px;margin-left: 10px;">
				<a href="#" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
				<a href="#" class="easyui-linkbutton" iconCls="icon-reload" id="resetBtn">重置</a>
				<a href="###" id="exportExcel" class="easyui-linkbutton">导出</a>
			</span>
		 
	</div>
</div>
<div class="mod mod1 parent-table">
	<div class="mod-header radius">
	<span style="float: left;font-weight:normal;font-size:18px;" id="a"></span><label style="float: left;font-weight:normal;font-size:18px;">${mainName}</label>
	</div>
	<div class="mod-body " id="data-load" >
	  <table class="data-load " width="20px" border="0" cellspacing="0" id="installation_table"></table>
	</div>
</div>

<script>
jQuery.ajaxSettings.traditional = true;
var data1;
$(function() {
	//执行扩展js
	if(typeof(initX) == 'function') {
		initX();
	}
	
	show();
	
	//查询
	$("#searchBtn").click(function() {
		getParam();
		show(); 
		
	});
	
	
	//导出excel
	$("#exportExcel").click(function() {
		window.location = "reportController.do?datagridGraph&export=1&" + $.param(getParam());
	});
	
	//重置
	$("#resetBtn").click(function() {
		window.location = "reportController.do?list&show=${show}&show2=${show2}&sat=${sat}&id="+'${config_id}';
	});
	
	//按回车键搜索
	$(".operations :input[name]").keydown(function(event) {
		if(event.keyCode == 13) {
			$("#searchBtn").click();
		}
	});
	
	$(window).resize(function() {
		reizeTable();
	});
});

function show() {
	getParam();
	$("#installation_table").datagrid(datagrid).datagrid("getPager").pagination({  
        beforePageText: '第', //页数文本框前显示的汉字    
        afterPageText: '页/{pages}页',   
        onBeforeRefresh: function () {  
            return true;  
        }  
    }); 
	
	
	//显示趋势图
	/* $.post("reportController.do?datagridGraph", getParam(), function(data) {
		log(data);
		time=eval(data).a;
		data = eval(data).rows;
		data1 = data; 
		$("#a").html(time);
			
			setTimeout(function() {
				showTable(data1);
			}, 1000);
	}); */
}
var param = {configId: '${config_id}'};
function getParam() {
	
	$(".operations :input[name]").each(function() {
		var name = $(this).attr("name");
		var value = $(this).val();
		//判断多选情况
		if($(this).hasClass('combo-value')) {
			value = new Array();
			$(":input[name='" + name + "']").each(function() {
				value.push($(this).val());
	
			});
		}
		param[name] = value;
	});

	return param;
}



//显示列表 

var columns = new Array();
	
	    <c:forEach var="filed" items="${filedlist }">
	    	if("${filed.is_show}"=='Y'){	
	    	columns.push({field:'${filed.field_name}',title:'${filed.field_txt}',width:100, sortable: true});
	    	}
	    </c:forEach> 
		
		
		columns = [columns];
	
		
	
var datagrid = {
		url:'reportController.do?datagridGraph',
	    columns: columns,
	    rownumbers:true,
        singleSelect:true,
        autoRowHeight:false,
		remoteSort:false,
        multiSort:false,
		showFooter: true,
		pagination:true,
		pageSize:30,
		pageList:[30,50],
		queryParams:param,
		onLoadSuccess: function (data) { 
			var time=eval(data).a;
			$("#a").html(time);
		}
		
	}

//显示列表
function showTable(data) {
	//执行扩展js
	if(typeof(xList) == 'function') {
		xList(data);
	}
	
	if(data.length > 19) {
		datagrid.height = 500;
	}
	
	//合计
	var totalRows = [];
	//执行扩展js
	if(typeof(getTotalRows) == 'function') {
		totalRows = getTotalRows(totalRows);
		datagrid.showFooter=true;
	}
	$("#installation_table").datagrid(datagrid);
	
	if(totalRows || totalRows.length > 0) {
		var total = {};
		$.each(data, function() {
			for(var i = 0; i < totalRows.length; i++) {
				var totalRow = totalRows[i];
				total[totalRow] = (total[totalRow] || 0) * 1 + (this[totalRow] || 0) * 1;
			}
		});
		for(key in total) {
			total[key] = "合计：" + total[key];
		}
		footer = [total];
		data = {
			total: data.length,
	    	rows: data,
	    	footer: footer
		}
		var time=eval(data).a;
		alert("aa"+data);
		$("#a").html(time);
	}
	
	
	$("#installation_table").datagrid('loadData', data);
	reizeTable();
	//执行扩展js，默认排序
	if(typeof(defaultSort) == 'function') {
		defaultSort();
	}
}

//调整列表宽度
function reizeTable() {
	$("#installation_table").datagrid("resize", { width: $("#data-load").width() });
}

//页面扩展js

</script>
</body>
</html>